package bm.com.framework.common.exception;

import bm.com.framework.common.config.EnumCode;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.stereotype.Component;

@Data
@AllArgsConstructor
@NoArgsConstructor
@Component
public class BmException extends RuntimeException{
    private static final long serialVersionUID = 1L;

    private Integer code;
    private String msg;

    public Integer getCode() {
            return code;
    }

    public String getMsg() {
            return msg;
    }

    public BmException(int code, String params) {
        this.code = code;
        this.msg = params;
    }

    public BmException(int code, Throwable e, String params) {
        super(e);
        this.code = code;
        this.msg = params;
    }

    public BmException(String msg) {
        super(msg);
        this.code = EnumCode.CODE_ERROR;
        this.msg = msg;
    }

    public BmException(String msg, Throwable e) {
        super(msg, e);
        this.code = EnumCode.SYSTEM_SERVER_ERROR;
        this.msg = msg;
    }


}
